<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
			var timer;
			function showTime(){
				document.getElementById("time").innerHTML=new Date().toLocaleString();
				
				timer=window.setInterval(function(){
					var d=new Date();
					document.getElementById("time").innerHTML=d.toLocaleString();
				},1000);
			}
			function stopTimer(){
				window.clearInterval(timer);
			}
		</script>
	</head>
	<body onload="showTime()">
		<div id="time"></div>
		<input type="button" value="stop" onclick="stopTimer()"/>
	</body>
</html>